3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/xen_nat_enable
3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/xen_nat_enable.README
3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/xen_read_console.c
+3f87ba90EUVPQLVOlFG0sW89BCwouQ tools/misc/xen_refresh_dev.c
3f72f1bdJPsV3JCnBqs9ddL9tr6D2g xen/COPYING
3f841450eJvqAD1Dldc0_aOweGiglQ xen/GUEST_CHANGES
3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile
clean:
find . -type f -name '*.o' | xargs rm -f
rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
+ find . -type l | xargs rm -f
%.o: %.c $(HDRS) Makefile
$(CC) $(CFLAGS) -c $< -o $@
--- /dev/null
+/******************************************************************************
+ * xen_refresh_dev.c
+ *
+ * Refresh our view of a block device by rereading its partition table. This
+ * is necessary to synchronise with VBD attaches and unattaches in Xen.
+ * Currently there's no automatic plumbing of attach/unattach requests.
+ *
+ * Copyright (c) 2003, K A Fraser
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mount.h> /* BLKRRPART */
+
+int main(int argc, char **argv)
+{
+ int fd;
+
+ if ( argc != 2 )
+ {
+ fprintf(stderr, "xen_refresh_dev <blkdev>\ne.g., /dev/xvda\n");
+ return 1;
+ }
+
+ if ( (fd = open(argv[1], O_RDWR)) == -1 )
+ {
+ fprintf(stderr, "Error opening %s: %s (%d)\n",
+ argv[1], strerror(errno), errno);
+ return 1;
+ }
+
+ if ( ioctl(fd, BLKRRPART) == -1 )
+ {
+ fprintf(stderr, "Error executing BLKRRPART on %s: %s (%d)\n",
+ argv[1], strerror(errno), errno);
+ return 1;
+ }
+
+ close(fd);
+
+ return 0;
+}